import Vue from "vue";
import App from "./App";
import store from "./store/index";
import api from "../src/api/api";
import AppleSliver from "./components/apple-sliver";
import NavBar from "./components/nav-bar";
import request from "./common/js/request";
import BigNumber from "bignumber.js";
import loadsh from "loadsh";
import "../src/static/iconfont/iconfont.css";
import "./assets/css/arrow.css";

Vue.prototype.$store = store;
Vue.prototype.$api = api;
Vue.prototype.$request = request;

Vue.prototype.$navigateBack = uni.navigateBack;
Vue.prototype.$navigateTo = uni.navigateTo;
Vue.prototype.$switchTab = uni.switchTab;

// 随机数
Vue.prototype.$random = (min, max) => {
	return Math.floor(Math.random() * (max - min)) + min;
}

// 米转千米
Vue.prototype.$MToKM = (meter, suffix = "") => {
	return loadsh.round(new BigNumber(meter).div(1000).toNumber(), 2) + "" + suffix;
}

Vue.component("apple-sliver", AppleSliver);
Vue.component("nav-bar", NavBar);

Vue.config.productionTip = false;
App.mpType = "app";

new Vue({
	...App
}).$mount();
